package com.zim.ta_service.base.model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {

    /**
     * 请求是否成功
     */
    private Boolean success;

    /**
     * 响应信息
     */
    private String message;

    /**
     * 响应对象
     */
    private Object data;

    public static R success() {
        return new R(true, "请求成功", null);
    }

    public static R success(Object data) {
        return new R(true, "请求成功", data);
    }

    public static R success(String message, Object data) {
        return new R(true, message, data);
    }

    public static R error(String message) {
        return new R(false, message, null);
    }

    public static R error(String message, Object data) {
        return new R(false, message, data);
    }
}
